package jiachunlei.proxy.lesson1;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * jdk动态代理
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2020/12/4 21:11
 * @see SubjectProxy
 */
public class ProxyClient
{
    public static void main(String[] args)
    {
        Subject subject = new SubjectImpl();
        InvocationHandler proxy = new SubjectProxy(subject);
        Subject o = (Subject)Proxy.newProxyInstance(subject.getClass().getClassLoader(), subject.getClass().getInterfaces(), proxy);
        o.hello("world");
    }
}
